package com.tanhua.admin.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.tanhua.model.domain.Analysis;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;


public interface AnalysisMapper extends BaseMapper<Analysis> {

    @Select("SELECT SUM(num_active)  FROM tb_analysis_by_day WHERE record_date >= #{lastmonth} and record_date <= #{today}")
    Integer activePassMonth(@Param("today") String today, @Param("lastmonth") String lastmonth);//30天活跃

    @Select("SELECT SUM(num_active)  FROM tb_analysis_by_day WHERE record_date >= #{lastweek} and record_date <= #{today}")
    Integer activePassWeek(@Param("today") String today, @Param("lastweek") String lastweek);//7天活跃

    @Select("SELECT SUM(num_registered)  FROM tb_analysis_by_day")
    Integer sum();//注册总数

    @Select("SELECT num_registered  FROM tb_analysis_by_day WHERE record_date = #{date}")
    Integer registered(@Param("date") String date);//注册

    @Select("SELECT num_active  FROM tb_analysis_by_day WHERE record_date = #{date}")
    Integer active(@Param("date") String date);//活跃

    @Select("SELECT num_login  FROM tb_analysis_by_day WHERE record_date = #{date}")
    Integer login(@Param("date") String date);//登录
}
